﻿
//房间信息
[System.Serializable]
public struct RoomInfo
{
    public int rId; //房间id
    public string pId; //房主id
    public int status; //状态0-准备中 1-战斗中
    public int pNum; //人数
    public int isPrivate;
    public int point;
    public int rules;
}

//请求房间列表
public class MsgGetRoomList : MsgBase
{
    public MsgGetRoomList()
    {
        protoName = "MsgGetRoomList";
    }

    //服务端回
    public RoomInfo[] rooms;
}

//创建房间
public class MsgCreateRoom : MsgBase
{
    public MsgCreateRoom()
    {
        protoName = "MsgCreateRoom";
    }

    //客户端发
    public int isPrivate = 0;
    public int point = 0;
    public int rules = 0;

    //服务端回
    public int result = 0;
}

//删除房间
public class MsgRemoveRoom : MsgBase
{
    public MsgRemoveRoom()
    {
        protoName = "MsgRemoveRoom";
    }

    //服务端回
    public int rId = 0;
}

//进入房间
public class MsgEnterRoom : MsgBase
{
    public MsgEnterRoom()
    {
        protoName = "MsgEnterRoom";
    }

    //客户端发
    public int rId = 0;

    //服务端回
    public int result = 0;
    public PlayerInfo pInfo;
}

public enum EnterRoomResult
{
    Successful,
    IsInRoom,
    Nonexistence,
    Other
}

//玩家信息
[System.Serializable]
public struct PlayerInfo
{
    public string pId; //账号
    public int win; //胜利数
    public int tot; //总场数
    public int isOwner; //是否是房主
    public int isPrepared;
}

//获取房间信息
public class MsgGetRoomInfo : MsgBase
{
    public MsgGetRoomInfo()
    {
        protoName = "MsgGetRoomInfo";
    }

    //服务端回
    public int rId = 0;
    public PlayerInfo[] pInfos;
    public int point = 0;
    public int rules = 0;
}

//离开房间
public class MsgLeaveRoom : MsgBase
{
    public MsgLeaveRoom()
    {
        protoName = "MsgLeaveRoom";
    }

    //服务端回
    public int result = 0;
    public string pId = "";
    public string newOwner = ""; //新的房主
}

//房主点击开战
public class MsgStartBattle : MsgBase
{
    public MsgStartBattle()
    {
        protoName = "MsgStartBattle";
    }

    //服务端回
    public int result = 0;
}

public enum StartBattleResult
{
    Successful,
    Nonexistence,
    NotOwner,
    IsBattling,
    NotEnoughPlayer,
    NotAllPrepare,
    Other
}

//玩家点击准备
public class MsgPrepareBattle : MsgBase
{
    public MsgPrepareBattle()
    {
        protoName = "MsgPrepareBattle";
    }

    //服务端回
    public int result = 0;
    public string pId = "";
}